home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
oper_sys
/
amber
/
amber.lha
/
Node.h
< prev
next >
Wrap
C/C++ Source or Header
|
1991-04-25
|
2KB
|
71 lines
#ifndef _node_h
#define _node_h
//
// There is one Node object per node. Application-visible node
// primitives (as commented below) are remotely invokable and are
// hacked to avoid actual remote invocations whenever possible.
// Node objects are not customizable.
//
#include "Defs.h"
#include "NamedObject.h"
class Node : public NamedObject {
int nodeid; // our node number
int nodecount; // how many active nodes
int numprocessors;
int preemptQuantum;
int shutdownFlag;
int shutdownStatus;
char hostname[HostLen];
public:
//
// These primitives are private to the kernel.
//
Node(int nodeId, int activeNodes, int cpus);
Node(int nodeId);
~Node();
int Init();
int Start(int quantum);
void Die(int propagate = 0);
void Run();
int AwaitShutdownRequest();
void Shutdown(int status);
// Objany RunThread(PFany pf, ...);
//
// These primitives may be used by the application.
//
void Halt(int status = 0);
void Abort();
void AbortWithoutCore(int status);
int NodeNum();
int NodeCount();
int Processors();
int Quantum();
Node *GetNodeRef(int nodeId);
Node *NextNode(Node *curNode = 0);
char *Hostname() // won't work remotely XXX
{ return hostname; }
int Spin(int spincount); // useful for testing
int Visit();
};
extern Node *thisnode;
//
// AmberState should probably be part of the node object, and needs a few
// more state values.
//
enum NodeState { StaticCtor, ProgramInit, RemoteStartup, LocalStartup,
RunningMain, ShuttingDown, StaticDtor };
extern NodeState AmberState;
//
// For use by the application.
//
#define MULTITHREADED() (AmberState == RunningMain)
#define SINGLETHREADED() (!MULTITHREADED())
#endif _node_h